package com.yoomiito.app.ui.my;

import android.os.Bundle;
import android.view.View;

import com.yoomiito.app.Constant;
import com.yoomiito.app.base.App;
import com.yoomiito.app.model.bean.TabBean;
import com.yoomiito.app.present.my.activity.MyMonthOrderPresenter;
import com.yoomiito.app.ui.fragment.my.MyMonthOrderFragment;
import com.yoomiito.app.ui.fragment.my.MyOrderBaseFragment;
import com.yoomiito.app.ui.my.income.IncomeForecastActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * 逐步废弃  目前 淘宝预计结算 还在使用 新的使用{@link IncomeForecastActivity}
 */
@Deprecated
public class MyMonthOrderActivity extends MyOrderBaseActivity<MyMonthOrderPresenter> {
    private int month;
    private String monthTitle;
    private String monthAmountDetail;
    private ArrayList<String> mData;

    @Override
    public MyMonthOrderPresenter newP() {
        return new MyMonthOrderPresenter(App.mAppConfig);
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        moneyTv.setText(getIntent().getStringExtra(Constant.KEY_ORDER_MONEY));
        mData = getIntent().getStringArrayListExtra(Constant.KEY_MONTH_DATA);

//        if (mData != null && mData.size() > 1){
//            month = Integer.parseInt(mData.get(2));
//            monthTitle = mData.get(0) + "结算预计";
//            monthTitle = mData.get(0) + "结算预计";
//            monthAmountDetail = getMonthStr(1,0);
//        }

        super.initData(savedInstanceState);
        titleView.setCenterText("淘宝结算预计");
        desTv.setVisibility(View.VISIBLE);
        desTv.setText("每个月25号结算上个月确认收货的淘宝订单");
    }

    private String getMonthStr(int lastMonth, int lastMonthDay) {
        int month = lastMonth == 1 ? 12 : lastMonth - 1;
//      return mData.get(0) + "结算预计：" + month + "月1日-"+ month +"月"+ lastMonthDay + "日确认收货的淘宝订单";
        return mData.get(0) + "结算预计：每个月25号结算上个月确认收货的淘宝订单";
    }

    @Override
    protected List<MyOrderBaseFragment> getAllFragment() {
        List<MyOrderBaseFragment> list = new ArrayList<>();
        MyMonthOrderFragment monthFm = new MyMonthOrderFragment();
        Bundle monthBundle = new Bundle();
        monthBundle.putInt(Constant.KEY_MONTH, month);
        monthFm.setArguments(monthBundle);
        list.add(monthFm);
        return list;
    }

    @Override
    protected List<TabBean> getTabList() {
        return null;
    }
}
